package cn.linkai.hadoop.invertedindex;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

public class InvertedIndexTwiceMRPartition extends Partitioner<Text,Text> {

    @Override
    public int getPartition(Text text, Text text2, int i) {
        String word=text.toString();
        char firstChar=word.charAt(0);
        if(firstChar>='A'&&firstChar<='M'||firstChar>='a'&&firstChar<='m'){
            return 0;
        }else if(firstChar>='N'&&firstChar<='Z'||firstChar>='n'&&firstChar<='z'){
            return 1;
        }else {
            return 2;
        }
    }
}
